/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2019 HUST Dian Group
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Original Author: Pengyu Liu <eicliupengyu@gmail.com>
 */

#include "ns3/log.h"
#include "robo-common.h"
#include "robo-geometry.h"
namespace ns3 {

const std::vector<FVector> gBoundaryPoints[MAX_ROBO_TYPE] = {
    std::vector<FVector> ({FVector (-0.2f, -0.2f), FVector (0.2f, -0.2f), FVector (0.2f, 0.2f),
                           FVector (-0.2f, 0.2f)}), //RoboTypeHero
    std::vector<FVector> ({FVector (-0.15f, -0.15f), FVector (0.15f, -0.15f),
                           FVector (0.15f, 0.15f), FVector (-0.15f, 0.15f)}), //RoboTypeInfantry
    std::vector<FVector> ({FVector (-0.1f, -0.1f), FVector (0.1f, -0.1f), FVector (0.1f, 0.1f),
                           FVector (-0.1f, 0.1f)}), //RoboTypeSentinel
    std::vector<FVector> ({FVector (-0.25f, -0.25f), FVector (0.25f, -0.25f),
                           FVector (0.25f, 0.25f), FVector (-0.25f, 0.25f)}), //RoboTypeEngineer
    std::vector<FVector> ({FVector (-0.15f, -0.15f), FVector (0.15f, -0.15f),
                           FVector (0.15f, 0.15f), FVector (-0.15f, 0.15f)}), //RoboTypeUVA
    std::vector<FVector> ({FVector (-0.2f, -0.2f), FVector (0.2f, -0.2f), FVector (0.2f, 0.2f),
                           FVector (-0.2f, 0.2f)}), //RoboTypeTower
};
const std::vector<FVector> gSupplyBoundary = std::vector<FVector> (
    {FVector (0.f, 0.f), FVector (0.f, 2.f), FVector (2.f, 2.f), FVector (2.f, 0.f)});
// enum eSelfMask {
//   SelfMaskBuilding = 1 << 0,
//   SelfMaskAmmo = 1 << 3,
//   SelfMaskHero = 1 << 7,
//   SelfMaskInfantry = 1 << 8,
//   SelfMaskSentinel = 1 << 9,
//   SelfMaskEngineer = 1 << 10,
//   SelfMaskUVA = 1 << 11,
//   SelfMaskTower = 1 << 12,
// };
const uint32_t gRoboMask[MAX_ROBO_TYPE] = {
    SelfMaskHero, //RoboTypeHero
    SelfMaskInfantry, //RoboTypeInfantry
    SelfMaskSentinel, //RoboTypeSentinel
    SelfMaskEngineer, //RoboTypeEngineer
    SelfMaskUVA, //RoboTypeUVA
    SelfMaskTower, //RoboTypeTower
};

const uint32_t gRoboCollisionMask[MAX_ROBO_TYPE] = {
    SelfMaskBuilding | SelfMaskAmmo | SelfMaskHero | SelfMaskInfantry | SelfMaskEngineer |
        SelfMaskTower, //RoboTypeHero
    SelfMaskBuilding | SelfMaskAmmo | SelfMaskHero | SelfMaskInfantry | SelfMaskEngineer |
        SelfMaskTower, //RoboTypeInfantry
    SelfMaskAmmo, //RoboTypeSentinel
    SelfMaskBuilding | SelfMaskAmmo | SelfMaskHero | SelfMaskInfantry | SelfMaskEngineer |
        SelfMaskTower, //RoboTypeEngineer
    SelfMaskBuilding, //RoboTypeUVA
    SelfMaskAmmo | SelfMaskHero | SelfMaskInfantry | SelfMaskEngineer, //RoboTypeTower
};

const uint32_t gAmmoCollisionMask = SelfMaskBuilding | SelfMaskHero | SelfMaskInfantry |
                                    SelfMaskSentinel | SelfMaskEngineer | SelfMaskTower;

const uint32_t gBuildingCollisionMask =
    SelfMaskAmmo | SelfMaskHero | SelfMaskInfantry | SelfMaskEngineer | SelfMaskUVA | SelfMaskTower;

const int gRoboMaxLife[MAX_ROBO_TYPE][MAX_PERFORMANCE_LEVEL] = {
    {200, 300, 500, 700}, //RoboTypeHero
    {100, 200, 300, 500}, //RoboTypeInfantry
    {600, 600, 600, 600}, //RoboTypeSentinel
    {500, 500, 500, 500}, //RoboTypeEngineer
    {M_INT_MAX, M_INT_MAX, M_INT_MAX, M_INT_MAX}, //RoboTypeUVA
    {1500, 1500, 1500, 1500}, //RoboTypeTower
};

const int gRoboVirtualShield[MAX_ROBO_TYPE] = {
    10, //RoboTypeHero
    10, //RoboTypeInfantry
    10, //RoboTypeSentinel
    10, //RoboTypeEngineer
    M_INT_MAX, //RoboTypeUVA
    50, //RoboTypeTower
};

const float gRoboUpgradeExp[MAX_ROBO_TYPE][MAX_LEVEL] = {
    {0.f, 8.f, 12.f}, //RoboTypeHero
    {0.f, 3.f, 6.f}, //RoboTypeInfantry
    {0.f, M_FLOAT_MAX, M_FLOAT_MAX}, //RoboTypeSentinel
    {0.f, M_FLOAT_MAX, M_FLOAT_MAX}, //RoboTypeEngineer
    {0.f, M_FLOAT_MAX, M_FLOAT_MAX}, //RoboTypeUVA
    {0.f, M_FLOAT_MAX, M_FLOAT_MAX}, //RoboTypeTower
};
const float gRoboExp[MAX_ROBO_TYPE][MAX_LEVEL] = {
    {7.5f, 10.f, 15.f}, //RoboTypeHero
    {2.5f, 5.f, 7.5f}, //RoboTypeInfantry
    {7.5f, 7.5f, 7.5f}, //RoboTypeSentinel
    {5.f, 5.f, 5.f}, //RoboTypeEngineer
    {0.f, 0.f, 0.f}, //RoboTypeUVA
    {0.f, 0.f, 0.f}, //RoboTypeTower
};
const bool gRoboNotShootable[MAX_ROBO_TYPE][MAX_WEAPON_ID] = {
    {0, 0}, //RoboTypeHero
    {0, 1}, //RoboTypeInfantry
    {0, 1}, //RoboTypeSentinel
    {1, 1}, //RoboTypeEngineer
    {0, 1}, //RoboTypeUVA
    {1, 1}, //RoboTypeTower
};
const float gRoboAutoIncExp[MAX_ROBO_TYPE] = {
    .4f, //RoboTypeHero
    .2f, //RoboTypeInfantry
    0.f, //RoboTypeSentinel
    .2f, //RoboTypeEngineer
    0.f, //RoboTypeUVA
    0.f, //RoboTypeTower
};
const float gRoboMaxSpeed[MAX_ROBO_TYPE] = {
    2.5f, //RoboTypeHero
    3.f, //RoboTypeInfantry
    .5f, //RoboTypeSentinel
    2.5f, //RoboTypeEngineer
    5.f, //RoboTypeUVA
    0.f, //RoboTypeTower
};
} // namespace ns3
